/*
 * @Description: 解构
 * @Author: admin
 * @Date: 2021-06-09 17:19:51
 * @LastEditors: admin
 * @LastEditTime: 2021-06-09 17:37:55
 */
// var arr = [1, 2, 3];
// var a = arr[2] //3
// console.log(a);

// var [, b, c] = [1, 2, 3];
// // console.log(c);


// var [a, b, c, [, d], e] = [1, 2, 3, [4, 5], 6];
// console.log(d);

// var [a, ...e] = [1, 2, 3, 4, 5]
// // 要数组的第一位
// console.log(a);
// // 要数组剩余的所有
// console.log(e);

// let { name, age } = { name: 'tom', age: '13' };

// console.log(name);
// console.log(age);

// 添加默认值
// var { name, age, gender = '男' } = { name: 'tom', age: '13' };

// console.log(name);
// console.log(age);
// console.log(gender);
// var { name, age, gender = '男' } = { name: 'tom', age: '13', gender: '女' };

// console.log(name);
// console.log(age);
// console.log(gender);

// 字符串解构
var [a, b, c, d, e] = 'hello';
console.log(a + b + c + d + e);

let { length: len, toString } = 'hello'
console.log(len);